<?php

// $Id$

require_once($WSC->get_site_inc_dir().'modules/tangra_cms/_sys/tcms_admin_page_w_grid_ua.class.php');
require_once($WSC->get_site_inc_dir().'modules/tangra_cms/grids/sitemap/sitemap_grid_ctrl.class.php');
require_once($WSC->get_site_inc_dir().'modules/tangra_cms/classes/sitemap/tcms_sitemap_generator.class.php');


class Sitemap_WP extends TCMS_Admin_Page_W_Grid_UA {
	public function create_view($name = 'default') {
		$ret = new TCMS_Admin_Page_View($this, $name, 'modules/tangra_cms/pages/_sitemap/');

		return $ret;
	}


	 protected function create_grid_ctrl() {
		$tvm = $this->get_tvm();
		$ret = new Sitemap_Grid_Ctrl('sitemap', $tvm, Tangra_Parameter_Method::GET);

		return $ret;
	 }


	 protected function default_event($page_num = NULL) {
		$filepath = $this->_config->get_scratch_dir().TCMS_Sitemap_Generator::SITEMAP_FILE;
		if (file_exists($filepath)) {
			$this->export('last_generated', date('Y-m-d H:i:s', filemtime($filepath)));
		}

	 	return parent::default_event($page_num);
	 }
}

